#include "Tools/ToolMassAdd.h"

using namespace Ogre;
ToolMassAdd::ToolMassAdd(Ogre::Camera *mCam, Ogre::SceneManager *mScMgr, std::string path, RaySceneQuery* ray)
{

	objectsPath=path;

	selectAreaObjectPath="..\\..\\media\\models\\barrel.mesh";
	std::string nodeName="AreaNode"+Constants::instance()->getNum();
    SceneNode *node;
	node = mScMgr->getRootSceneNode()->createChildSceneNode(nodeName);

    Entity *ent = mScMgr->createEntity(nodeName, selectAreaObjectPath);
	node->attachObject(ent);
	node->showBoundingBox(true);

	moveObject = new ActionMoveObject(mCam,node,ray);
	moveCam = new ActionMoveCamera(mCam);
	scale = new ActionScaleObject(node);
}

ToolMassAdd::~ToolMassAdd(){}

void ToolMassAdd::updateGraphics(const FrameEvent &evt){

	moveCam->updateGraphics(evt);
	moveObject->updateGraphics(evt);
}

void ToolMassAdd::mouseMoved(const OIS::MouseEvent &evt){

	scale->mouseMoved(evt);
	moveObject->mouseMoved(evt);
	moveCam->mouseMoved(evt);
}

void ToolMassAdd::mousePressed(const OIS::MouseEvent &evt){
	
	/*
	Afegir els objectes dins de la carpeta selectAreaObjectPath amb randoms, dins de l'area marcada pel moveObject i sense q colisionin
	*/
}

void ToolMassAdd::keyPressed(const OIS::KeyEvent &evt){
	
	moveCam->keyPressed(evt);
}
void ToolMassAdd::keyReleased(const OIS::KeyEvent &e){

	moveCam->keyReleased(e);
}
